<template>
  <div class="contain">
    <header>
      <div class="returns" @click="goBack()">
        <i class="iconfont icon-fanhui"></i>
      </div>

      <div class="go-home">
        <img src="@/assets/images/home.png" alt="" />
      </div>
    </header>

    <div class="row">
      <div class="col-xs-6" v-for="item in chashuList" :key="item.id">
        <router-link :to="'/detail/' + item.id">
          <div class="item">
            <img :src="item.imgUrl" alt="" />
            <h2>{{ item.name }}</h2>
            <p>￥ {{ item.price }}</p>
          </div>
        </router-link>
      </div>
    </div>

    <div class="floot">
      <div class="line-l"></div>
      <span>店铺信息</span>
      <div class="line-r"></div>
      <img src="../../../public/images/底部.jpg" alt="" />
    </div>
  </div>
</template>

<script>
import http from "@/common/api/request.js";
export default {
  data() {
    return {
      chashuList: [],
    };
  },
  created() {
    this.getChashu();
  },

  methods: {
    //   获取茶书分类
    async getChashu() {
      let res = await http.$axios({
        url: "http://127.0.0.1:3008/goods/goodsbookslist",
      });
      this.chashuList = res;
    },

    // 返回上一级
    goBack() {
      this.$router.go(-1);
    },
  },
};
</script>

<style scoped lang="scss">
a{
    color: #454545;
    text-decoration: none;
}
.contain {
  margin-bottom: 20px;
  font-family: STFangsong;
  letter-spacing: 1px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;

  background-color: #b0352f;
  .returns {
    line-height: 1.173333rem;
    padding: 0 0.533333rem;
    i {
      color: #fff;
      font-size: 0.693333rem;
    }
  }
  .go-home {
    padding: 0 0.266666rem;
    line-height: 1.173333rem;
    img {
      width: 35px;
      height: 35px;
      margin-top: 9px;
    }
  }
}

.row {
  margin-top: -24px;
  margin-left: 0;
  margin-right: 0;
  display: flex;
  flex-wrap: wrap;

  .col-xs-6 {
    width: 44%;
    border-radius: 9px;
    display: flex;
    padding: 0;
    margin-left: 13px;
    margin-right: 6px;
    box-shadow: 6px 6px 6px #c0c0c0;
    margin-top: 33px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  img {
    border-radius: 9px;
    width: 167px;
    margin-top: 8px;
    height: 154px;
  }
  h2 {
    font-size: 18px;
    margin-top: 25px;
    margin-bottom: 8px;
    margin-left: 7px;
  }

  span {
    font-size: 13px;
    margin-left: 92px;
    letter-spacing: 1px;
    transform: scale(0.9);
    display: inline-block;
    margin-bottom: 11px;
  }
  P {
    margin-left: 5px;
    font-size: 18px;
    color: #fd3f31;
    margin-top: 18px;
  }
}

.floot {
  font-size: 20px;
  text-align: center;
  margin-top: 62px;

  .line-l,
  .line-r {
    width: 104px;
    height: 1px;
    background-color: #d5d5d5;
    margin-bottom: -17px;
  }
  .line-l {
    margin-left: 13px;
  }
  span {
    color: black;
  }
  .line-r {
    margin-left: 276px;
    margin-top: -13px;
  }
  img {
    vertical-align: middle;
    width: 200px;
    margin-top: 37px;
  }
}
</style>
